using System.Collections.Generic;

namespace UsersSettingsTool.Options
{
    public class RecordPerPage
    {
        private sealed class ValueEqualityComparer : IEqualityComparer<RecordPerPage>
        {
            public bool Equals(RecordPerPage x, RecordPerPage y)
            {
                if (ReferenceEquals(x, y)) return true;
                if (ReferenceEquals(x, null)) return false;
                if (ReferenceEquals(y, null)) return false;
                if (x.GetType() != y.GetType()) return false;
                return x.Value == y.Value;
            }

            public int GetHashCode(RecordPerPage obj)
            {
                return obj.Value;
            }
        }

        private static readonly IEqualityComparer<RecordPerPage> ValueComparerInstance = new ValueEqualityComparer();

        public static IEqualityComparer<RecordPerPage> ValueComparer
        {
            get { return ValueComparerInstance; }
        }

        public RecordPerPage(string text, int value)
        {
            Text = text;
            Value = value;
        }

        public string Text;

        public int Value;

        public RecordPerPage()
        {
            Text = "<Default>";
            Value = 50;
        }
    }
}